package com.wn.controller;

import com.wn.entity.RbacRole;
import com.wn.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/role")
public class RoleController {
    @Autowired()
    private RoleService roleService;
    @PostMapping("/add")
    @ResponseBody
    public String insert(RbacRole rbacRole){
       roleService.insert(rbacRole);
       return "OK";

    }
    @GetMapping("/manage")
    public String add() {
        return "/role_manage";
    }

    @GetMapping("/getAll")
    @ResponseBody
    public List<RbacRole> getAll(){
        return roleService.getAll();
    }
}
